package com.smcdd.cdb.dbo.cdb_dbo.network;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * 作者：Administrator on 2017/7/5 14:12
 * 邮箱：zhanghuaiha@gmail.com
 */

public enum RetrofitWifi {
    INSTANCE;
    public String BASEURL = "http://192.168.4.1";
    public static final int DEFAULT_TIMEOUT = 10;

    private Retrofit retrofit;
    OkHttpClient client = new OkHttpClient.Builder()
            .connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
            .writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
            .readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
            .build();



    RetrofitWifi() {
        retrofit = new Retrofit.Builder()
                //设置OKHttpClient
                .client(OKHttpFactory.INSTANCE.getOkHttpClient())

                //baseUrl
                .baseUrl(BASEURL)

                //gson转化器
                .addConverterFactory(GsonConverterFactory.create())
                .client(client)

                .build();
    }
    public Retrofit getRetrofit() {
        return retrofit;
    }
}
